// 云函数入口文件
const cloud = require('wx-server-sdk')

cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  let { id } = event
  var success = false
  var message = "删除失败"
  const db = cloud.database()
  await db.collection('absence-list').where({
    _id: id
  }).remove().then(res => {
    success = true
    message = "删除成功"
  }, error => {
    success = false
    message = "删除失败，请联系管理员"
  })

  return {
    success: success,
    message: message
  }
}